﻿using System;
using AudioBookWS.ServiceUtil;
using AudioCore.Common;

namespace AudioBookWS
{
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            string strConfigValue = string.Empty;

            // Load data folder
            AudioCore.Common.AppConfigUtils.GetString(Constant.ConfigKey.DATA_FOLDER, ref strConfigValue);
            GlobalParam.DataFolder = strConfigValue;

            // Load message when request invalid
            AppConfigUtils.GetString(WSConstants.ConfigKey.CORE_INVALID_REQUEST, ref strConfigValue);
            GlobalParam.InvalidRequest = strConfigValue;

            // Load message not register
            AppConfigUtils.GetString(WSConstants.ConfigKey.CORE_NOT_REGISTED_MESSAGE, ref strConfigValue);
            GlobalParam.NotRegisedMessage = strConfigValue;

            // Load message login fail
            AppConfigUtils.GetString(WSConstants.ConfigKey.CORE_LOGIN_FAIL, ref strConfigValue);
            GlobalParam.LoginFail = strConfigValue;

            // Load message message change pass successfully
            AppConfigUtils.GetString(WSConstants.ConfigKey.CORE_CHANGE_PASS_SUCCESS, ref strConfigValue);
            GlobalParam.ChangePassSuccess = strConfigValue;

            // Load message change pass fail
            AppConfigUtils.GetString(WSConstants.ConfigKey.CORE_CHANGE_PASS_FAIL, ref strConfigValue);
            GlobalParam.ChangePassFail = strConfigValue;

            // Load message send password to email successfully
            AppConfigUtils.GetString(WSConstants.ConfigKey.CORE_SEND_PASSWORD_TO_EMAIL_SUCCESS, ref strConfigValue);
            GlobalParam.SendPasswordToEmailSuccess = strConfigValue;

            //Load message register successfully
            AppConfigUtils.GetString(WSConstants.ConfigKey.CORE_REGISTER_SUCCESS, ref strConfigValue);
            GlobalParam.RegisterSuccess = strConfigValue;

            //Load message register fail
            AppConfigUtils.GetString(WSConstants.ConfigKey.CORE_REGISTER_FAIL, ref strConfigValue);
            GlobalParam.RegisterFail = strConfigValue;

            // Load message register email exist
            AppConfigUtils.GetString(WSConstants.ConfigKey.CORE_EMAIL_EXIST, ref strConfigValue);
            GlobalParam.EmailExist = strConfigValue;

            // Load message register email not exist
            AppConfigUtils.GetString(WSConstants.ConfigKey.CORE_EMAIL_NOT_EXIST, ref strConfigValue);
            GlobalParam.EmailNotExist = strConfigValue;

            // Load message register account exist
            AppConfigUtils.GetString(WSConstants.ConfigKey.CORE_ACCOUNT_EXIST, ref strConfigValue);
            GlobalParam.AccountExist = strConfigValue;
        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}